﻿'功能說明：系統主網址 : 分為banner及mainPage1
'建立人員: andy
'建立日期：2011/2/4
'****************************************************
Imports System.Data
Partial Class WebForm_Main_MainPage
    Inherits System.Web.UI.Page
    Public Sub RequestLogin()

        Dim logid As String = Context.User.Identity.Name
        logid = logid.Substring(logid.IndexOf("\") + 1)

        Dim bbl As OAMS.BBL.UsersBBL = New OAMS.BBL.UsersBBL()
        Dim dt As DataTable = bbl.GetUsersLogin(logid, "telecom")

        Session("UID") = dt.Rows(0)("UserID").ToString
        Session("UserName") = dt.Rows(0)("UserName").ToString
        Session("ActualUID") = dt.Rows(0)("UserID").ToString
        Session("ActualUserName") = dt.Rows(0)("UserName").ToString

        Session("dbName") = "telecom"

        Dim bbl1 As OAMS.BBL.UsersBBL = New OAMS.BBL.UsersBBL()
        Session("GlobalLanguage") = "zh-tw"

    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Try
            If Session("UID") = Nothing Then
                RequestLogin()
            End If
        Catch ex As Exception

            Dim logid As String = Context.User.Identity.Name
            logid = logid.Substring(logid.IndexOf("\") + 1)
            Response.Write(logid + ex.Message + ":User Not Found")
            Exit Sub
        End Try
        Dim path As String = ""
        If Request.QueryString.Count > 0 Then

            path = HttpUtility.UrlDecode(Request.QueryString.ToString()).Substring(5)
            Session("myURL") = Me.ResolveUrl(path)
            Response.Redirect(Me.Request.Url.AbsolutePath)
        End If


    End Sub
End Class
